import { createRouter, createWebHashHistory } from 'vue-router';
const Recommend = () => import('@/views/recommend.vue'/* webpackChunkName: "recomment" */);
const Singer = () => import('@/views/singer.vue'/* webpackChunkName: "singer" */);
const Search = () => import('@/views/search.vue'/* webpackChunkName: "search" */);
const topList = () => import('@/views/top-list.vue'/* webpackChunkName: "top-list" */);
const SingerDetail = () => import('@/views/singer-detail.vue'/* webpackChunkName: "singer-detail" */);
const Album = () => import('@/views/album.vue'/* webpackChunkName: "album" */);
const TopDetail = () => import('@/views/top-detail.vue'/* webpackChunkName: "top-detail" */);
const userCenter = () => import('@/views/user-center.vue'/* webpackChunkName: "user-center" */);
const routes = [
  {
    path: '/',
    name: 'index',
    redirect: '/recommend'
  },
  {
    path: '/recommend',
    name: 'recommend',
    component: Recommend,
    children: [
      {
        path: ':id',
        name: 'album',
        component: Album
      }
    ]
  },
  {
    path: '/singer',
    name: 'singer',
    component: Singer,
    children: [
      {
        path: ':id',
        name: 'singer-detail',
        component: SingerDetail
      }
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: Search,
    children: [
      {
        path: ':id',
        name: 'search-detail',
        component: SingerDetail
      }
    ]
  },
  {
    path: '/top-list',
    name: 'top-list',
    component: topList,
    children: [
      {
        path: ':id',
        name: 'top-detail',
        component: TopDetail
      }
    ]
  },
  {
    path: '/user',
    name: 'user-center',
    components: {
      user: userCenter
    }
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
